import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class homework4 {
    public static void main(String[] args) {

        List<student> list = new ArrayList<>();

        list.add(new student("张三", "男", "16", "88"));
        list.add(new student("张三", "男", "16", "88"));
        for (student student : list) {
            System.out.println(student.getSex());
            try (FileWriter s = new FileWriter("C:\\1.1\\student.txt", true);) {

                s.write(student.getName() + student.getScore() + student.getAge() + student.getSex() + "\r\n");
                s.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


//
//
//    }


    }
}
